import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { useUserStore } from '/@/store/modules/user';
const userStore = useUserStore();

//列表数据
export const columns: BasicColumn[] = [
   {
    title: '班组编码',
    align:"center",
    dataIndex: 'orgCode'
   },
   {
    title: '班组名称',
    align:"center",
    dataIndex: 'orgName'
   },
   {
    title: '系数名称',
    align:"center",
    dataIndex: 'xsName'
   },
   {
    title: '系数编码',
    align:"center",
    dataIndex: 'xsCode'
   },
   {
    title: '排序',
    align:"center",
    dataIndex: 'displayOrder'
   },
   {
    title: '描述',
    align:"center",
    dataIndex: 'remark'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    field: 'orgCode',
    component: 'Select',
    label: '班组1',
    componentProps: {
      options: userStore.getTeamList,
    },
    defaultValue: userStore.getOrgCode,
    colProps: { span: 8 },
  },
  {
    field: 'xsName',
    label: '工作系数名称',
    component: 'Input',
    colProps: { span: 8 },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '班组编码',
    field: 'orgCode',
    component: 'Input',
    dynamicDisabled: () => true,
  },
  {
    label: '班组名称',
    field: 'orgName',
    component: 'Input',
    dynamicDisabled: () => true,
  },
  {
    label: '系数名称',
    field: 'xsName',
    component: 'Input',
  },
  {
    label: '系数编码',
    field: 'xsCode',
    component: 'Input',
  },
  {
    label: '排序',
    field: 'displayOrder',
    component: 'InputNumber',
  },
  {
    label: '描述',
    field: 'remark',
    component: 'InputTextArea',
    componentProps: {
      maxlength: 50,
      showCount: true,
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}